Fixed includes in arch/arm/src/stm32l4/hardware/.#14
Closed
wingunder wants to merge 1 commit into
Closed
Conversation
Several header files in arch/arm/src/stm32l4/hardware/ had the following line included: #include "chip.h" The problem with this was that the chip.h file is missing in this directory (in arch/arm/src/stm32l4/hardware/). The intended chip.h file to include was probably in arch/arm/src/stm32l4/chip.h. If any of the headers in arch/arm/src/stm32l4/hardware/ got included from a directory that did not contain a chip.h file, the compilation failed. After looking deeper into this I realized that the following files were also including files with the wrong paths: - arch/arm/src/stm32l4/hardware/stm32l4_syscfg.h - arch/arm/src/stm32l4/hardware/stm32l4_pinmap.h Finally, it seems as if a lot of headers, but not all, included: #include <nuttx/config.h> In this case, the include is only useful if a CONFIG_* define is being referenced. These includes were removed from files that had no CONFIG_* references and added to files that had CONFIG_* references, but was missing the include. The final change to be mentioned, was the moving of the GPIO defines from arch/arm/src/stm32l4/stm32l4_gpio.h to arch/arm/src/stm32l4/hardware/stm32l4_gpio.h. This was done to supply arch/arm/src/stm32l4/hardware/stm32l4*_pinmap.h with a local include for their GPIO references. This patch changes no functionality. It simply cleans up includes and allows inclusion of the headers in arch/arm/src/stm32l4/hardware/ from anywhere, without causing compiler errors.
Contributor
|
I don't believe this change should be incorporated upstream. It does not handle the include paths and it takes perfectly compliant code and makes it inconsistent with everyother architecute. Consistency must be preserved. |
Contributor
|
Hi wingunder, please note that normally header files included inside stm32l4/hardware/ directory are mainly used for internal chip registers definitions and the headers at base of stm324/ contains definitions that will be outside of arch/ dir i.e. inside boards/ . Also note that all arch follow this logic, if you want to change it you need to do it for all arch, not only for stm32l4. |
Contributor
Author
|
Hi @patacongo & @acassis, |
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Several header files in arch/arm/src/stm32l4/hardware/ had the
following line included:
#include "chip.h"
The problem with this was that the chip.h file is missing in this
directory (in arch/arm/src/stm32l4/hardware/). The intended chip.h
file to include was probably in arch/arm/src/stm32l4/chip.h. If any of
the headers in arch/arm/src/stm32l4/hardware/ got included from a
directory that did not contain a chip.h file, the compilation
failed.
After looking deeper into this I realized that the following files
were also including files with the wrong paths:
Finally, it seems as if a lot of headers, but not all, included:
#include <nuttx/config.h>
In this case, the include is only useful if a CONFIG_* define is
being referenced. These includes were removed from files that had no
CONFIG_* references and added to files that had CONFIG_* references,
but was missing the include.
The final change to be mentioned, was the moving of the GPIO defines
from arch/arm/src/stm32l4/stm32l4_gpio.h to
arch/arm/src/stm32l4/hardware/stm32l4_gpio.h. This was done to supply
arch/arm/src/stm32l4/hardware/stm32l4*_pinmap.h with a local include
for their GPIO references.
This patch changes no functionality. It simply cleans up includes and
allows inclusion of the headers in arch/arm/src/stm32l4/hardware/
from anywhere, without causing compiler errors.